package org.myspring.lifecycle;

import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class UserService implements IUserService, InitializingBean,DisposableBean,BeanNameAware {

	private String userName;

	public void setUserName(String userName) {
		System.out.println("1、set property method(setUserName) call...");		
		this.userName = userName;
	}

	public UserService() {
		System.out.println("1、constructor call...");
	}

	@Override
	public String getUserName() {
		System.out.println("7、business method(getUserName) call...");		
		return "jackie";
	}
	
	@Override
	public void setBeanName(String name) {
		System.out.println("2、bean setBeanName call...");		
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("4、InitializingBean::afterPropertiesSet call...");
	}

	@Override
	public void destroy() throws Exception {
		System.out.println("8、DisposableBean::destroy call...");
	}
	
	public void myinit() {
		System.out.println("5、myinit call...");
	}
	
	public void mydestroy() {
		System.out.println("9、mydestroy call...");
	}

}